-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Actions] Adjust axios payload for APIs that do not want data
sent
#165756
Conversation
Pinging @elastic/security-solution (Team: SecuritySolution) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! thx
It's just sooo wrong to send any data on a GET
, but ES actually requires it for some calls. I think a number of servers and gateways actually choke on this! I imagine we've not seen problems as nearly every service being used by the connectors uses POST ...
@elasticmachine merge upstream |
Pinging @elastic/uptime (Team:uptime) |
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…lastic#165756) (cherry picked from commit d6a2bd7)
…` sent (#165756) (#165851) # Backport This will backport the following commits from `main` to `8.10`: - [[Actions] Adjust axios payload for APIs that do not want `data` sent (#165756)](#165756) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-09-06T13:38:39Z","message":"[Actions] Adjust axios payload for APIs that do not want `data` sent (#165756)","sha":"d6a2bd77788c318a9f74247a52a1b6da05779b4b","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team: SecuritySolution","v8.10.0","v8.11.0"],"number":165756,"url":"https://github.com/elastic/kibana/pull/165756","mergeCommit":{"message":"[Actions] Adjust axios payload for APIs that do not want `data` sent (#165756)","sha":"d6a2bd77788c318a9f74247a52a1b6da05779b4b"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165756","number":165756,"mergeCommit":{"message":"[Actions] Adjust axios payload for APIs that do not want `data` sent (#165756)","sha":"d6a2bd77788c318a9f74247a52a1b6da05779b4b"}}]}] BACKPORT--> Co-authored-by: Steph Milovic <[email protected]>
Problem: Cases Webhook Connector throwing vague error
A customer reported issues while using the Webhook - Case Management connector (
cases_webook
). This is the error they saw:After gaining access to an instance of TheHive5, I was able to narrow down the issue to the GET incident call. When I removed the data object from being sent as
{}
when undefined, the error went away and the call succeeded. I usedcurl
against the Hive5 API directly. As suspected, when a data object is included the API throws:{"type":"NotFoundError","message":"/api/v1/case/~122917056"}
. It seems likely axios swallowed that error.Solution: Removing
data
when undefinedAs mentioned above, I am removing the axios data argument instead of being sent as
{}
when undefined. A GET request doesn't usually transmit data in any other way besides passing an encoded string in the URL. I think it makes sense to not send data when it is undefined vs sending an empty object as it can break some 3rd party APIs as we are seeing with Hive5To test
Use these TheHive5 credentials. to create a cases webhook connector.
Run the test, post a sample case.
Confirm you see a successful post:
Extra confirm by logging into the hive with the above credentials and see the case you created there